package com.cc.pojo.file;

import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author c.c
 * @Description 生成文件地址和类名
 * @since 2023/3/30
 */

@NoArgsConstructor
@Data
public class FilePathAndClassName<T extends BuiderAbstract> {

  //文件生成路径如：com\cc\infrastructure\db
  private String filePath;
  private String className;

  //带文件的生成路径如：com\cc\infrastructure\db\AgencybankaccountDb.java
  private String classFilePath;

  private T buildClass;

  public FilePathAndClassName(String filePath, String className, T buildClass) {
    this.filePath = filePath.replace(".", "\\");
    this.className = className;
    this.buildClass = buildClass;

    this.classFilePath = this.filePath + "\\" + className + ".java";
  }

//  public FilePathAndClassName(String filePath, String className) {
//    this.filePath = filePath;
//    this.className = className;
//    String path = this.classFilePath.putIfAbsent(className, filePath + "\\" + className + ".java" );
//    if (StringUtils.isNotBlank(path)){
//      throw new RuntimeException("类名存在重复");
//    }
//  }
//  /**
//   *
//   * @author C.c
//   * @since 2023-04-07 17:22
//   * @param filePath 文件位置如 temp\sosmcc\123
//   * @param className 生成的类名 如：ssx.java
//  **/
//
//  public void setAll(String filePath, String className,T buildClass){
//    this.filePath = filePath;
//    this.className = className;
//    String path = this.classFilePath.putIfAbsent(className, filePath + "\\" + className + ".java" );
//    if (StringUtils.isNotBlank(path)){
//      throw new RuntimeException("类名存在重复");
//    }
//  }
}
